home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / intrvews / xgrab.lha / xgrab / include / dialogbox.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-04-24  |  2.7 KB  |  128 lines

  1. /**
  2.    GRAB Graph Layout and Browser System
  3.  
  4.    Copyright (c) 1987, 1988, 1989 Stanford University
  5.    Copyright (c) 1989, Tera Computer Company
  6.  **/
  7.  
  8. #ifndef dialogbox_h
  9. #define dialogbox_h
  10.  
  11. #include "stringedit.h"
  12. #include <InterViews/scene.h>
  13. #include <InterViews/message.h>
  14.  
  15. // Declare imported types.
  16.  
  17. class ButtonState;
  18. class StringEdit;
  19.  
  20. // An IMessage displays its own text, not somebody else's.
  21.  
  22. class IMessage : public Message 
  23. {
  24. public:
  25.     IMessage(const char* = nil, Alignment a = Center);
  26.     ~IMessage();
  27.  
  28.     void SetText(const char* = nil, const char* = nil);
  29. protected:
  30.     char* buffer;        // stores own copy of text
  31. };
  32.  
  33. // A DialogBox knows how to set its message and warning text and how
  34. // to pop up itself over the underlying Interactor.
  35.  
  36. class DialogBox : public MonoScene 
  37. {
  38. public:
  39.  
  40.     void SetMessage(const char* = nil, const char* = nil);
  41.     void SetWarning(const char* = nil, const char* = nil);
  42.     void SetUnderlying(Interactor*);
  43.  
  44. protected:
  45.  
  46.     DialogBox(Interactor*, const char* = nil);
  47.  
  48.     void PopUp();
  49.     void Disappear();
  50.  
  51.     IMessage* message;        // displays message text
  52.     IMessage* warning;        // displays warning text
  53.     Interactor* underlying;    // we'll insert ourselves into its parent
  54.  
  55. };
  56.  
  57. // A Messager displays a message until it's acknowledged.
  58.  
  59. class Messager : public DialogBox 
  60. {
  61. public:
  62.  
  63.     Messager(Interactor*, const char* = nil);
  64.     ~Messager();
  65.  
  66.     void Display();
  67.  
  68. protected:
  69.  
  70.     void Init();
  71.     void Reconfig();
  72.  
  73.     ButtonState* ok;        // stores status of "ok" button
  74.     Interactor* okbutton;    // displays "ok" button
  75.  
  76. };
  77.  
  78. // A Confirmer displays a message until it's confirmed or cancelled.
  79.  
  80. class Confirmer : public DialogBox 
  81. {
  82. public:
  83.  
  84.     Confirmer(Interactor*, const char* = nil);
  85.     ~Confirmer();
  86.  
  87.     char Confirm();
  88.  
  89. protected:
  90.  
  91.     void Init();
  92.     void Reconfig();
  93.  
  94.     ButtonState* yes;        // stores status of "yes" button
  95.     ButtonState* no;        // stores status of "no" button
  96.     ButtonState* cancel;    // stores status of "cancel" button
  97.     Interactor* yesbutton;    // displays "yes" button
  98.     Interactor* nobutton;    // displays "no" button
  99.     Interactor* cancelbutton;    // displays "cancel" button
  100.  
  101. };
  102.  
  103. // A Namer displays a string until it's edited or cancelled.
  104.  
  105. class Namer : public DialogBox 
  106. {
  107. public:
  108.  
  109.     Namer(Interactor*, const char* = nil);
  110.     ~Namer();
  111.  
  112.     char* Edit(const char*);
  113.  
  114. protected:
  115.  
  116.     void Init();
  117.     void Reconfig();
  118.  
  119.     ButtonState* accept;    // stores status of "accept" button
  120.     ButtonState* cancel;    // stores status of "cancel" button
  121.     Interactor* acceptbutton;    // displays "accept" button
  122.     Interactor* cancelbutton;    // displays "cancel" button
  123.     StringEdit* stringeditor;    // displays and edits a string
  124.  
  125. };
  126.  
  127. #endif
  128.